package org.lanqiao.tjut.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.lanqiao.tjut.bean.UserBean;
import org.lanqiao.tjut.dao.UserDao;
import org.lanqiao.tjut.mapper.UserBeanMapper;
import org.springframework.stereotype.Repository;

@Repository("UserInfoDAO")
public class UserInfoDAO implements UserDao {
	@Resource
	private UserBeanMapper userMapper;

	@Override
	public UserBean selectByUserIndex(String userIndex) {
		// 根据主键查询该用户信息
		return userMapper.selectByUserIndex(userIndex);
	}

	@Override
	public UserBean selectByUserAccount(String userAccount) {
		// 根据账号查询用户信息
		return userMapper.selectByUserAccount(userAccount);
	}

	@Override
	public List<UserBean> selectAllUsers() {
		// 查询所有用户信息
		List<UserBean> lstUser = userMapper.selectAllUsers();
		return lstUser;
	}

	@Override
	public int insertUserInfo(UserBean userB) {
		// 添加用户信息
		int i = userMapper.insertUserInfo(userB);
		return i;
	}

	@Override
	public int updateUserByIndex(UserBean userB) {
		// 修改用户信息（主键）
		int i = userMapper.updateUserByIndex(userB);
		return i;
	}

	@Override
	public List<UserBean> selectUserInfoDynamic(UserBean userB) {
		// 模糊查询用户信息
		List<UserBean> lstUser = userMapper.selectUserInfoDynamic(userB);
		return lstUser;
	}

	@Override
	public int deleteByUserIndex(UserBean userB) {
		// 删除用户信息(主键)
		int i = userMapper.deleteByUserIndex(userB);
		return i;
	}

}
